import type {
  IGetCodeParms,
  LoginCodeData,
  LoginCodeParams,
  loginData,
  UserData,
  userDataParams,
} from '@/types/user'
import request from '@/utils/request'

export const loginByPasswordAPI = (data: userDataParams) => {
  return request.post<null, loginData>('/login/password', data)
}

export const getCodeAPI = (params: IGetCodeParms) => {
  return request.get<null, { code: string }>('/code', { params })
}

export const loginByMobileApi = (data: LoginCodeParams) => {
  return request.post<null, LoginCodeData>('/login', data)
}

export const getUserInfoApi = () => {
  return request.get<null, UserData>('/patient/myUser')
}
